// 版权归陈超所有

#pragma once

#include "CoreMinimal.h"
#include "UI/WidgetController/CC_WidgetController.h"
#include "CC_OverlayWidgetController.generated.h"

struct FGameplayTagContainer;
class UCC_AbilitySystemComponent;
struct FOnAttributeChangeData;
class UCC_AttributeSet;
//添加动态多播委托
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnHealthChangedSignature, float, NewHealth);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnMaxHealthChangedSignature, float, NewMaxHealth);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnManaChangedSignature, float, NewMana);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnMaxManaChangedSignature, float, NewMaxMana);



/**
 * 
 */
UCLASS(Blueprintable)
class CC_AURA_API UCC_OverlayWidgetController : public UCC_WidgetController
{
	GENERATED_BODY()
public:
	//广播初始值
	virtual void BroadcastInitialValues() override;
	
	/*依赖的绑定回调函数
	 * 1.监听属性变化
	 * 2.监听效果演员标签
	 */
	virtual void BindCallbacksToDependencies() override;
protected:
	//动态多播委托
	UPROPERTY(BlueprintAssignable, Category="GAS|Attributes")
	FOnHealthChangedSignature OnHealthChanged;
	
	UPROPERTY(BlueprintAssignable, Category="GAS|Attributes")
	FOnMaxHealthChangedSignature OnMaxHealthChanged;
	
	UPROPERTY(BlueprintAssignable, Category="GAS|Attributes")
	FOnManaChangedSignature OnManaChanged;
	
	UPROPERTY(BlueprintAssignable, Category="GAS|Attributes")
	FOnMaxManaChangedSignature OnMaxManaChanged;

private:
	UPROPERTY()
	TObjectPtr<UCC_AttributeSet> CC_AttributeSet;

	UPROPERTY()
	TObjectPtr<UCC_AbilitySystemComponent> CC_AbilitySystemComponent;
	
	//属性变化的回调函数
	void HealthChanged(const FOnAttributeChangeData& Data) const;
	void MaxHealthChanged(const FOnAttributeChangeData& Data) const;
	void ManaChanged(const FOnAttributeChangeData& Data) const;
	void MaxManaChanged(const FOnAttributeChangeData& Data) const;
	
};
